from math import sqrt

prime = []
prime.append(2)
prime.append(3)
prime.append(5)
prime.append(7)
x = 11
EkkiPrime = False
while len(prime) < 1001:
	Breyta = int(sqrt(x)) 
	for y in range(2, Breyta+1, 1):
		if x%y == 0:
			EkkiPrime = True
	if EkkiPrime == False:
		prime.append(x)
	x += 1
	EkkiPrime = False

fjoldi = int(input())
for x in range(fjoldi):
	prufa = int(input())
	print(prime(prufa))
		

# Virkar
